// --------------------------------------------------------------------------------------------------------------------
// <copyright file="RobotLandmarkCameraCalibrationInfo.cs" company="Microsoft Corporation">
// The MIT License (MIT)
// 
// Copyright (c) 2014, Microsoft Corporation
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
//  in the Software without restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the Software is
//  furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in
//  all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//  THE SOFTWARE.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace Microsoft.Robotics.Navigation.Runtime.GroundTruthExtraction
{
    using System;
    using System.IO;
    using System.Runtime.CompilerServices;
    using System.Runtime.Serialization;

    using Microsoft.Robotics.IO;
    using Microsoft.Robotics.Numerics;

    /// <summary>
    /// Class encapsulating the Robot Landmark Camera tilt parameters.
    /// Please refer to <![CDATA[http://sharepoint/sites/Baker/Baker%20Wiki/Calibrating%20landmarks%20and%20robot%20upward%20facing%20camera.aspx]]>
    /// for determining these values.
    /// </summary>
    [DataContract]
    public class RobotLandmarkCameraCalibrationInfo
    {
        /// <summary>
        /// Camera optical axis to horizontal plane azimuth angle.
        /// </summary>
        [DataMember(Name = "AzimuthAngle")]
        private double azimuthAngle;

        /// <summary>
        /// Camera optical axis to horizontal plane tilt angle.
        /// </summary>
        [DataMember(Name = "TiltAngle")]
        private double tiltAngle;

        /// <summary>
        /// Robot to camera offset in x direction in meters.
        /// </summary>
        [DataMember(Name = "RobotToCameraOffsetX")]
        private double robotToCameraOffsetX;

        /// <summary>
        /// Robot to camera offset in y direction in meters.
        /// </summary>
        [DataMember(Name = "RobotToCameraOffsetY")]
        private double robotToCameraOffsetY;

        /// <summary>
        /// Robot to camera offset in heading in radians.
        /// </summary>
        [DataMember(Name = "RobotToCameraOffsetHeading")]
        private double robotToCameraOffsetHeading;

        /// <summary>
        /// Initializes a new instance of the <see cref="RobotLandmarkCameraCalibrationInfo"/> class.
        /// </summary>
        /// <param name="azimuthAngle">Camera optical axis to horizontal plane azimuth angle.</param>
        /// <param name="tiltAngle">Camera optical axis to horizontal plane tilt angle.</param>
        /// <param name="robotToCameraOffsetX">Robot wheel center to camera offset X (meters) when measured with the camera under landmark center and
        /// robot having the same heading as landmark axis x projected on the floor.
        /// </param>
        /// <param name="robotToCameraOffsetY">Robot wheel center to camera offset Y (meters)  when measured with the camera under landmark center and
        /// robot having the same heading as landmark axis x projected on the floor.</param>
        /// <param name="robotToCameraOffsetHeading">Robot to camera offset heading (radians)  when measured with the camera under landmark center and
        /// robot having the same heading as landmark axis x projected on the floor. This can be read directly from the reported camera pose.</param>
        public RobotLandmarkCameraCalibrationInfo(
            double azimuthAngle,
            double tiltAngle,
            double robotToCameraOffsetX,
            double robotToCameraOffsetY,
            double robotToCameraOffsetHeading)
        {
            this.azimuthAngle = azimuthAngle;
            this.tiltAngle = tiltAngle;
            this.robotToCameraOffsetX = robotToCameraOffsetX;
            this.robotToCameraOffsetY = robotToCameraOffsetY;
            this.robotToCameraOffsetHeading = robotToCameraOffsetHeading;
        }

        /// <summary>
        /// Gets or sets the AzimuthAngle of optical axis with respect to horizontal plane.
        /// </summary>
        public double AzimuthAngle
        {
            get
            {
                return this.azimuthAngle;
            }

            set
            {
                this.azimuthAngle = value;
            }
        }

        /// <summary>
        /// Gets or sets the Tilt Angle of optical axis with respect to horizontal plane .
        /// </summary>
        public double TiltAngle
        {
            get
            {
                return this.tiltAngle;
            }

            set
            {
                this.tiltAngle = value;
            }
        }

        /// <summary>
        /// Gets or sets the Robot to Camera Offset in X .
        /// </summary>
        public double RobotToCameraOffsetX
        {
            get
            {
                return this.robotToCameraOffsetX;
            }

            set
            {
                this.robotToCameraOffsetX = value;
            }
        }

        /// <summary>
        /// Gets or sets the Robot to Camera Offset in Y .
        /// </summary>
        public double RobotToCameraOffsetY
        {
            get
            {
                return this.robotToCameraOffsetY;
            }

            set
            {
                this.robotToCameraOffsetY = value;
            }
        }

        /// <summary>
        /// Gets or sets the Robot to Camera Offset in Heading .
        /// </summary>
        public double RobotToCameraOffsetHeading
        {
            get
            {
                return this.robotToCameraOffsetHeading;
            }

            set
            {
                this.robotToCameraOffsetHeading = value;
            }
        }
    }
}
